package zust.study.设计模式.创建型模式.建造者模式;

/**
 * @author senselyan
 * @date 2018/5/31 16:40
 */
public class BuilderPatternDemo {
}

interface Item {
    public String name();
    public Packing packing();
    public float price();
}

interface Packing {
    public String pack();
}
class Wrapper implements Packing {

    @Override
    public String pack() {
        return "Wrapper";
    }
}
class Bottle implements Packing {

    @Override
    public String pack() {
        return "Bottle";
    }
}
abstract class Burger implements Item {

    @Override
    public Packing packing() {
        return new Wrapper();
    }

    @Override
    public abstract float price();
}
abstract class ColdDrink implements Item {

    @Override
    public Packing packing() {
        return new Bottle();
    }

    @Override
    public abstract float price();
}

class VegBurger extends Burger {

    @Override
    public float price() {
        return 25.0f;
    }

    @Override
    public String name() {
        return "Veg Burger";
    }
}

class ChickenBurger extends Burger {

    @Override
    public float price() {
        return 50.5f;
    }

    @Override
    public String name() {
        return "Chicken Burger";
    }
}